#ifndef _LINUX_BINFMTS_H
#define _LINUX_BINFMTS_H

#include <linux/list.h>
#include <linux/fs2.h>

#include <asm/thread_info.h>

#define MAX_ARG_STRINGS 0x7FFFFFFF

#define BINPRM_BUF_SIZE 128

struct linux_binprm{
	char buf[BINPRM_BUF_SIZE];
// #ifdef CONFIG_MMU
	struct vm_area_struct *vma;
// #else
// # define MAX_ARG_PAGES	32
	// struct page *page[MAX_ARG_PAGES];
// #endif
	struct mm_struct *mm;
	unsigned long p; /* current top of mem */
	unsigned int
		cred_prepared:1,/* true if creds already prepared (multiple
				 * preps happen for interpreters) */
		cap_effective:1;/* true if has elevated effective capabilities,
				 * false if not; except for init which inherits
				 * its parent's caps anyway */
// #ifdef __alpha__
// 	unsigned int taso:1;
// #endif
	unsigned int recursion_depth;
	struct file * file;
	// struct cred *cred;	/* new credentials */
	int unsafe;		/* how unsafe this exec is (mask of LSM_UNSAFE_*) */
	unsigned int per_clear;	/* bits to clear in current->personality */
	int argc, envc;
	unsigned long argv;
	char * filename;	/* Name of binary as seen by procps */
	char * interp;		/* Name of the binary really executed. Most
				   of the time same as filename, but could be
				   different for binfmt_{misc,script} */
	unsigned interp_flags;
	unsigned interp_data;
	unsigned long loader, exec;
};

struct linux_binfmt {
	struct list_head lh;
	// struct module *module;
	int (*load_binary)(struct linux_binprm *, struct  pt_regs * regs);
	int (*load_shlib)(struct file *);
	int (*core_dump)(long signr, struct pt_regs *regs, struct file *file, unsigned long limit);
	unsigned long min_coredump;	/* minimal dump size */
	int hasvdso;
};

#endif
